package boot

import (
	"fmt"
	"github.com/smokezl/matryoshka"
)

func NewCache() {
	var conf = &matryoshka.RedisConfig{
		Addr:        "127.0.0.1:6379",
		MaxRetry:    2,
		Pwd:         "",
		IdleTimeout: 10,
		ConnTimeout: 100,
		MaxIdle:     50,
		MaxActive:   500,
	}

	m := matryoshka.Init(
		matryoshka.WithErrHandler(func(ctx context.Context, err error) {
			fmt.Println("test print,", err)
		}),
		matryoshka.WithDistributedCache(matryoshka.NewDefaultCache(conf)),
	)

	h := m.NewCache("info", 20)

	ctx := context.Background()

	soureLoadFn := func(ctx context.Context, key string) (string, error) {
		return "product info", nil
	}
}
